package com.sjzxywlkj.cplife.alipay.conn;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.request.AlipayEcoCplifeBillBatchUploadRequest;
import com.alipay.api.request.AlipayEcoCplifeBillBatchqueryRequest;
import com.alipay.api.request.AlipayEcoCplifeBillDeleteRequest;
import com.alipay.api.request.AlipayEcoCplifeBillModifyRequest;
import com.alipay.api.response.AlipayEcoCplifeBillBatchUploadResponse;
import com.alipay.api.response.AlipayEcoCplifeBillBatchqueryResponse;
import com.alipay.api.response.AlipayEcoCplifeBillDeleteResponse;
import com.alipay.api.response.AlipayEcoCplifeBillModifyResponse;
import com.sjzxywlkj.cplife.alipay.config.AlipayConfig;
import com.sjzxywlkj.cplife.alipay.request.entity.BillBatchquery;
import com.sjzxywlkj.cplife.alipay.request.entity.BillBatchupload;
import com.sjzxywlkj.cplife.alipay.request.entity.BillDelete;
import com.sjzxywlkj.cplife.alipay.request.entity.BillModify;

/**
 * 账单操作
 */
public class BillConn {

    //批量上传待缴物业费账单
    public static AlipayEcoCplifeBillBatchUploadResponse batchUpload(BillBatchupload billBatchupload, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeBillBatchUploadRequest request = new AlipayEcoCplifeBillBatchUploadRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(billBatchupload.toJson());
        AlipayEcoCplifeBillBatchUploadResponse response = alipayClient.execute(request);
        return response;
    }

    // 删除已上传的物业费账单数据
    public static AlipayEcoCplifeBillDeleteResponse delete(BillDelete billDelete, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeBillDeleteRequest request = new AlipayEcoCplifeBillDeleteRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(billDelete.toJson());
        AlipayEcoCplifeBillDeleteResponse response = alipayClient.execute(request);
        return response;
    }

    //修改已上传的物业费账单数据
    public static AlipayEcoCplifeBillModifyResponse modify(BillModify billModify, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeBillModifyRequest request = new AlipayEcoCplifeBillModifyRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(billModify.toJson());
        AlipayEcoCplifeBillModifyResponse response = alipayClient.execute(request);
        return response;
    }

    //物业费账单数据批量查询
    public static AlipayEcoCplifeBillBatchqueryResponse batchQuery(BillBatchquery billBatchquery, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeBillBatchqueryRequest request = new AlipayEcoCplifeBillBatchqueryRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(billBatchquery.toJson());
        AlipayEcoCplifeBillBatchqueryResponse response = alipayClient.execute(request);
        return response;
    }
}
